<#import "spring.ftl" as spring />
<link rel="stylesheet" href="${baseweb}/module/decorator/css/jquery-ui-1.8.13.custom.css" type="text/css" media="screen" />
<script type="text/javascript"
        src="${baseweb}/module/decorator/js/jquery-1.5.2.min.js">
</script>
<script type='text/javascript'
        src="${baseweb}/module/decorator/js/jquery-tools.js">
</script>
<script type="text/javascript"
      src="${baseweb}/module/decorator/js/jquery-ui-1.8.13.custom.min.js">
</script>
	<script type="text/javascript">

var baseweb =  '${baseweb}'; 

</script> 
<script type="text/javascript"
        src="${baseweb}/module/decorator/js/addSaleSetup.js">
</script>
<script type="text/javascript"
        src="${baseweb}/module/decorator/js/productTableSetup.js">
</script>
<script type="text/javascript"
        src="${baseweb}/module/decorator/js/customerTableSetup.js">
</script>
	<link type="text/css" rel="stylesheet" href="${baseweb}/module/ajax/yui/datatable/assets/skins/sam/datatable.css"/>
	<link type="text/css" rel="stylesheet" href="${baseweb}/module/ajax/yui/container/assets/skins/sam/container.css"/>
    <script type="text/javascript" src="${baseweb}/module/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="${baseweb}/module/ajax/yui/calendar/calendar-min.js"></script>
    <!-- Connection required when using XHR DataSource --> 
    <script type="text/javascript" src="${baseweb}/module/ajax/yui/connection/connection-min.js"></script> 
    <script type="text/javascript" src="${baseweb}/module/ajax/yui/element/element-min.js"></script>
    <script type="text/javascript" src="${baseweb}/module/ajax/yui/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="${baseweb}/module/ajax/yui/datatable/datatable-min.js"></script> 
	<script type="text/javascript" src="${baseweb}/module/ajax/yui/autocomplete/autocomplete-min.js"></script>
	<script type="text/javascript" src="${baseweb}/module/ajax/yui/dragdrop/dragdrop-min.js" ></script>
	<script type="text/javascript" src="${baseweb}/module/ajax/yui/container/container-min.js" ></script>
<#setting number_format="0.##">
<#setting locale="en_US">
<div class="saleSection">
  <span>Customer Information</span>
</div>
<div id="customerTemplate" class="itemTemplate">
    <span>
      <label for="customertId">Customer Id:</label>
      <input type="text" id="customerId" name="customerId" value="0" readonly="true" size="3"/>
    </span>
    <span>
      <label for="name">Customer Name:</label>
      <input type="text" id="customerName" name="customerName" value="" readonly="true" size="30"/>
    </span>
    <span>
      <label for="amount">CUIT/CUIL:</label>
      <input type="text" id="cuil" name="cuil" value="0" style="text-align:right" size="12"/>
    </span>
    <a id="activateCustomerTable" class="lookupTableActivator" href="#">Select Customer</a>
    <span>
      <button type="button" id="newCustomer" title="-1" onclick="javascript:window.location='${baseweb}/module/customer/editCustomer.do'">
       New Customer
      </button>
  </span>
</div>
<div class="saleSection">
  <span>Product Information</span>
</div>
<div id="itemTemplate" class="itemTemplate">
    <span>
      <label for="productId">Product Id:</label>
      <input type="text" id="productId" name="productId" value="0" readonly="true" size="3"/>
      <label for="name">Product Name:</label>
      <input type="text" id="productName" name="productName" value="" readonly="true" size="30"/>
      <a id="activateProductTable" class="lookupTableActivator" href="#">Select Product</a>
    </span>
    <span>
      <label for="amount">Amount:</label>
      <input type="text" id="amount" name="amount" value="0" style="text-align:right" size="5"/>
    </span>
    <span>
      <label for="price">Price Unit:</label>
      <input type="text" id="price" name="price" value="0" style="text-align:right" size="5"/>
    </span>
    <span>
      <label for="total">Total:</label>
      <input type="text" id="total" name="total" value="0" style="text-align:right" size="5"/>
    </span>
    <span>
      <button type="button" id="addItem" title="-1">
       Add Item
    </button>
  </span>
</div>
<#include "productTable.ftl">
<#include "customerTable.ftl">
<div style="min-height:300px; border:solid 2px; color: #838383;">
  <table id="itemList" class="results bottomMargin saleTable" width="100%" cellspacing="0" cellpadding="0" border="0">
      <col width="4%" />
      <col width="6%" />
      <col width="50%" />
      <col width="10%" />
      <col width="10%" />
      <col width="10%" />
      <col width="10%" />
    <thead>
      <tr>
        <th>#Item</th>
        <th>Product Id</th>
        <th>Product Name</th>
        <th>Price Unit</th>
        <th>Amount</th>
        <th>Total</th>
        <th>Action</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
  </table>
</div>
<form id="addSale" name="addSale" action="addSale.do" method="POST">
  <span class="error" id="message">
    <@spring.bind "command.*"/>
    <@spring.showErrors  "<br/>" />
  </span>
<input type="hidden" id="theCustomerId" name="customerId" value="0"/>
<input type="hidden" id="theCustomerName" name="customerName" value="0"/>
<input type="hidden" id="theCustomerCuil" name="customerCuil" value="0"/>
<div class="saleSection">
  <span>Detalles de pago</span>
</div>
<div class="itemTemplate">
  <span>
      <label for="amount" style="color:#000000; font-weight:inherit;">Efectivo:</label>
      <input type="text" id="amountCash" name="amountCash" value="0" style="text-align:right" size="5"/>
  </span>
  <span>
      <label for="amount" style="color:#000000; font-weight:inherit;">Tarjeta Crédito:</label>
      <input type="text" id="amountDebitCard" name="amountDebitCard" value="0" style="text-align:right" size="5"/>
  </span>
  <span>
      <label for="amount" style="color:#000000; font-weight:inherit;" >Tarjeta Débito:</label>
      <input type="text" id="amountCreditCard" name="amountCreditCard" value="0" style="text-align:right" size="5"/>
  </span>
  <#--@spring.formRadioButtons "command.paymentSelected", command.paymentTypes, ""/-->
</div>
<div class="saleSection" style="margin-top:5px;">
  <span>Detalles de cheque</span>
</div>
<div id="checkOptions" class="itemTemplate">
  <span>$ Valor:<input type="text" id="amountCheck" name="amountCheck" value="0"/></span>
  <span>N° Cheque:<input type="text" id="numCheck" name="numCheck" value=""/></span>
  <span>Fecha(dd-mm-yyyy):<input type="text" id="dateCheck" name="dateCheck" value=""/></span>
  <span>Banco:<input type="text" id="bankCheck" name="bankCheck" value=""/></span>
</div>
<div class="saleSection">
  <@spring.formRadioButtons "command.ticketTypeSelected", command.ticketTypes, ""/>
</div>
<div class="saleSection">
  <span>Resumen de venta:</span>
  <span style="float:right">Total Pagado:  $&nbsp;<input type="text" id="totalPayed" name="totalPayed" value="0" style="text-align:right" readonly="true" />
  <span style="float:right">Total a Cta Cte:  $&nbsp;<input type="text" id="totalAccount" name="totalAccount" value="0" style="text-align:right" readonly="true"/>
  <span style="float:right">Total de Venta:  $&nbsp;<input type="text" id="totalSale" name="totalSale" value="0" style="text-align:right" readonly="true"/>
  <input type="submit" id="submit" name="submit" value="Save" /></span>
</div>
</form>